package com.yckj.day07;

import java.util.Objects;

/**
 * TODO
 *
 * @author shengyuee
 * @version 1.0
 * 2025/7/24 15:01
 */
public class Teacher2  extends  Person{
    private String tid;
    private double salary;

    public Teacher2(String tid, double salary) {
        this.tid = tid;
        this.salary = salary;
    }

    public Teacher2(String name, String tid, double salary) {
        super(name);
        this.tid = tid;
        this.salary = salary;
    }

    public String getTid() {
        return tid;
    }

    public void setTid(String tid) {
        this.tid = tid;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    /**
     * 重写Object的equals()方法
     * @param o
     * @return
     */
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Teacher2 teacher2 = (Teacher2) o;
        return Double.compare(salary, teacher2.salary) == 0 && Objects.equals(tid, teacher2.tid);
    }

    /**
     * 重写hashCode方法
     * @return
     */
    @Override
    public int hashCode() {
        return Objects.hash(tid, salary);
    }
}
